package cn.com.xxlibrary.action;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import cn.com.xxlibrary.service.IIndexService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

@Controller
@ParentPackage("myStruts")
@Namespace(value = "/")
public class IndexAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Resource
	private IIndexService indexService;
	private int as;

	@Action(value = "mainFrame", results = { @Result(name = SUCCESS, location = "/main.jsp") })
	public String mainFrame() {
		ActionContext.getContext().getSession()
				.put("SESSION_MENUS", indexService.queryMenus(as));
		return SUCCESS;
	}

	public int getAs() {
		return as;
	}

	public void setAs(int as) {
		this.as = as;
	}

}
